package com.cch.cooperation.api.vip.service;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.cch.cooperation.dao.vip.mapper.VipAdConfigMapper;
import com.cch.cooperation.dao.vip.model.VipAdConfig;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class VipAdConfigServiceImpl {

    @Resource
    private VipAdConfigMapper mapper;

    public VipAdConfig get() {
        LambdaQueryWrapper<VipAdConfig> query = new LambdaQueryWrapper<>();
        query.orderByDesc(VipAdConfig::getCreateTime);
        List<VipAdConfig> list = mapper.selectList(query);
        return CollUtil.isNotEmpty(list) ? list.get(0) : null;
    }
}
